import pygame


class Zombie(pygame.sprite.Sprite):
    def __init__(self, imgs=[], position=(0, 100), plantName="car"):
        super().__init__()
        self.images = imgs
        self.currentImgIndex = 0
        self.position = position
        self.plantName = plantName
        self.count = 0
        self.speed = 2
        self.rect = self.images[self.currentImgIndex].get_rect()
        self.rect.x = position[0]
        self.rect.y = position[1]
        self.hp = 3

    def update(self):
        self.rect.x = self.rect.x - self.speed
        if self.rect.x  < 100:
            return False
        else:
            return True

    def draw(self, screen):
        screen.blit(self.images[self.currentImgIndex], self.rect)
        self.currentImgIndex += 1
        if self.currentImgIndex >= len(self.images):
            self.currentImgIndex = 0